#!/bin/sh

old=$1
new=$2
flag=$3

# If HEAD didn't change or if this is just a file checkout, do a complete
# permissions fix.
if [ "$old" = 0000000000000000000000000000000000000000 ] || [ "$old" = "$new" ] || [ "$flag" = 0 ] ; then
	set "$new"
else
	set "$old" "$new"
fi

exec "$(git config oasis.root)"/libexec/applyperms "$@"
